package com.cipe.cmrs.bean;

import org.apache.commons.lang.StringUtils;

public class PayeeBean {
    private String address1;
    private String address2;
    private String city;
    private String state;
    private String zipCode;
    private String country;
    private String completeAddress;

    public String getAddress1() {
        return address1;
    }

    public void setAddress1(String address1) {
        this.address1 = address1;
    }

    public String getAddress2() {
        return address2;
    }

    public void setAddress2(String address2) {
        this.address2 = address2;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getCompleteAddress() {
        return completeAddress;
    }

    public void generateCompleteAddress() {
        StringBuilder result = new StringBuilder("");
        if (StringUtils.isNotBlank(getAddress1())) {
            result.append(getAddress1());
        }
        if (StringUtils.isNotBlank(getAddress2())) {
            if (StringUtils.isNotBlank(result.toString())) {
                result.append(" ");
            }
            result.append(getAddress2());
        }
        if (StringUtils.isNotBlank(getCity())) {
            if (StringUtils.isNotBlank(result.toString())) {
                result.append(", ");
            }
            result.append(getCity());
        }
        if (StringUtils.isNotBlank(getState())) {
            if (StringUtils.isNotBlank(result.toString())) {
                result.append(", ");
            }
            result.append(getState());
        }
        if (StringUtils.isNotBlank(getZipCode())) {
            if (StringUtils.isNotBlank(result.toString())) {
                result.append(" ");
            }
            result.append(getZipCode());
        }
        if (StringUtils.isNotBlank(getCountry())) {
            if (StringUtils.isNotBlank(result.toString())) {
                result.append(" ");
            }
            result.append(getCountry());
        }
        completeAddress = result.toString();
    }

}
